﻿using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;

public class EditorMenu
{
    [MenuItem("Tools/添加网格碰撞器", false, 80)]
    public static void AddMeshCoilder()
    {
        MeshRenderer[] meshRenderers = GameObject.FindObjectsOfType<MeshRenderer>();
        for (int i = 0; i < meshRenderers.Length; i++)
        {
            MeshRenderer meshRenderer = meshRenderers[i];
            MeshCollider meshColliderExist = meshRenderer.gameObject.GetComponent<MeshCollider>();
            if (meshColliderExist == null)
                meshRenderer.gameObject.AddComponent<MeshCollider>();
        }
    } 
}
